﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects;
using System.Data.Entity;
using Survey.Model.EntriesEntities;
using Survey.Model.SurveyEntities;

namespace Survey.Data
{
    public class SurveyContext : ObjectContext
    {
        public SurveyContext() : base("name=SurveyORMContainer", "SurveyORMContainer")
        {
        }
        
        private IObjectSet<Director> _directors;
        public IObjectSet<Director> Director
        {
            get
            {
                if (_directors == null)
                {
                    _directors = CreateObjectSet<Director>();
                }
                return _directors;
            }
        }

        private IObjectSet<LearningMaterial> _learningMaterial;
        public IObjectSet<LearningMaterial> LearningMaterials
        {
            get
            {
                if (_learningMaterial == null)
                {
                    _learningMaterial = CreateObjectSet<LearningMaterial>();
                }
                return _learningMaterial;
            }
        }

        private IObjectSet<School> _schools;
        public IObjectSet<School> School
        {
            get
            {
                if (_schools == null)
                {
                    _schools = CreateObjectSet<School>();
                }
                return _schools;
            }
        }

        private IObjectSet<Student> _students;
        public IObjectSet<Student> Students
        {
            get
            {
                if (_students == null)
                {
                    _students = CreateObjectSet<Student>();
                }
                return _students;
            }
        }

        private IObjectSet<StudentClass> _studentClasses;
        public IObjectSet<StudentClass> StudentClasses
        {
            get
            {
                if (_studentClasses == null)
                {
                    _studentClasses = CreateObjectSet<StudentClass>();
                }
                return _studentClasses;
            }
        }

        private IObjectSet<Teacher> _teachers;
        public IObjectSet<Teacher> Teachers
        {
            get
            {
                if (_teachers == null)
                {
                    _teachers = CreateObjectSet<Teacher>();
                }
                return _teachers;
            }
        }

        private IObjectSet<GlobalSurvey> _globalsurveis;
        public IObjectSet<GlobalSurvey> GlobalSurveis
        {
            get
            {
                if (_globalsurveis== null)
                {
                    _globalsurveis = CreateObjectSet<GlobalSurvey>();
                }
                return _globalsurveis;
            }
        }

        private IObjectSet<SurveyEntity> _surveis;
        public IObjectSet<SurveyEntity> SurveyEntities
        {
            get
            {
                if (_surveis == null)
                {
                    _surveis = CreateObjectSet<SurveyEntity>();
                }
                return _surveis;
            }
        }

        private IObjectSet<Questionary> _questionaries;
        public IObjectSet<Questionary> Questionaries
        {
            get
            {
                if (_questionaries == null)
                {
                    _questionaries = CreateObjectSet<Questionary>();
                }
                return _questionaries;
            }
        }

        private IObjectSet<Question> _questions;
        public IObjectSet<Question> Questions
        {
            get
            {
                if (_questions == null)
                {
                    _questions = CreateObjectSet<Question>();
                }
                return _questions;
            }
        }
    }
}